package cn.iocoder.yudao.module.written.exam.dal.dataobject.llm;

import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonSubTypes;
import com.fasterxml.jackson.annotation.JsonTypeInfo;
import lombok.Data;

/**
 * 大模型事件基类
 *
 * @author 芋道源码
 */
@Data
@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, property = "event", visible = true)
@JsonSubTypes({
        @JsonSubTypes.Type(value = WorkflowStartedEvent.class, name = "workflow_started"),
        @JsonSubTypes.Type(value = MessageEvent.class, name = "message"),
        @JsonSubTypes.Type(value = WorkflowFinishedEvent.class, name = "workflow_finished"),
        @JsonSubTypes.Type(value = NodeFinishedEvent.class, name = "node_finished"),
        @JsonSubTypes.Type(value = MessageEndEvent.class, name = "message_end")
})
public abstract class LlmEventBase {

    /**
     * 事件类型
     */
    @JsonProperty("event")
    private String event;

    /**
     * 对话ID
     */
    @JsonProperty("conversation_id")
    private String conversationId;

    /**
     * 消息ID
     */
    @JsonProperty("message_id")
    private String messageId;

    /**
     * 创建时间
     */
    @JsonProperty("created_at")
    private Long createdAt;

    /**
     * 任务ID
     */
    @JsonProperty("task_id")
    private String taskId;

    /**
     * 获取事件类型 {@link LlmEventTypeEnum}
     *
     * @return 事件类型枚举
     */
    public abstract LlmEventTypeEnum getType();
}